import * as ActionTypes from './mutation-types'
export default {
    /**
     * @description: 商品购买列表
     * @param {type} 
     * @return: 
     */
    [ActionTypes.ADD_BUYLIST]( state, val ){
        state.BUYLIST = val
    },

    /**
     * @description: 订单页面 选择地址 记录一下
     * @param {type} 
     * @return: 
     */    
    [ActionTypes.ADD_SELECT_ADDRESS]( state, val ){
        state.SELECT_ADDRESS = val
    },
    /**
     * @description: 增加失败的异步队列
     * @param {type} 
     * @return: 
     */
    [ActionTypes.ADD_PROMISEQUEUE]( state, val ){
        state.PROMISEQUEUE.push(val)
    },

    /**
     * @description: 同步用户信息
     * @param {type} 
     * @return: 
     */    
	
    [ActionTypes.ADD_USERINFO]( state, val ){
        state.USER = val
    },

    [ActionTypes.GET_PRODUCTS_LIST]( state, val ){
        state.PRODUCTS_LIST = val
    },
	
	[ActionTypes.UPDATE_USER_ROLE](state, val) {
		state.USER.role = val
	},
	
	[ActionTypes.UPDATE_MALL_OWNER](state, userInfo) {
		state.mallOwner = userInfo
	},
	
	[ActionTypes.UPDATE_HAS_AGENTOR](state, val) {
		state.USER.isHasAgentor = val
	},
	
	/**
	 * @description: 更新用户id
	 * @param {type} 
	 * @return: 
	 */  
	[ActionTypes.UPDATE_CUSTOMER_ID]( state, val ){
	    state.customerId = val
	},
	
	/**
	 * @description: 更新进入商品分类的时候携带的参数
	 * @param {type} 
	 * @return: 
	 */  
	[ActionTypes.CLASSIFY_PAGES_PARAMS]( state, val ){
	    state.CLASSIFY_PAGES_PARAMS = val
	},
	
	/**
	 * @description 设置系统信息
	 */
	[ActionTypes.SET_SYSTEM_INFO](state, info) {
		state.systemInfo = info
	},
	
	[ActionTypes.USER_LOGOUT](state) {
		state.USER = {
			username: "游客1002",
			face: "https://cwmall.oss-cn-shanghai.aliyuncs.com/mp-icon/mine_def_touxiang_3x.png",
			signature: "点击头像进行登录哦",
			role: 1,
			islogin: false,
		}
		uni.clearStorageSync()
	}
	
}